package com.example.courseapp.bean;

import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.Date;

public class ChildInformation implements Serializable {
    /*儿童信息添加
     * bmi
     * */
    private Integer childID;

    private User user;

    private String childName;

    private float height;

    private float weight;

    private int age;
    private String sex;

    private String birthdate;


    private double bmi;


    public void setBmi(double bmi) {
        this.bmi = bmi;
    }

    public void updateBmi() {
        setBmi(weight / (height / 100 * height / 100));
    }


    public Integer getChildID() {
        return childID;
    }

    public void setChildID(Integer childID) {
        this.childID = childID;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getChildName() {
        return childName;
    }

    public void setChildName(String childName) {
        this.childName = childName;
    }

    public float getHeight() {
        return height;
    }

    public void setHeight(float height) {
        this.height = height;
    }

    public float getWeight() {
        return weight;
    }

    public void setWeight(float weight) {
        this.weight = weight;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getBirthdate() {
        return birthdate;
    }

    public void setBirthdate(String birthdate) {
        this.birthdate = birthdate;
    }

    public String getBmi() {
//        DecimalFormat decimalFormat = new DecimalFormat("#.#");
//
//        // 使用 DecimalFormat 格式化 float 值
//        String formattedValue = decimalFormat.format(weight/(height/100*height/100));
//        return formattedValue;
        return bmi + "";
    }


}
